﻿Imports System.Web
Imports Mysoft.Map.Data
Imports System.Configuration
Imports Mysoft.Map.Application.Security
Imports System.Data.SqlClient


Public Class IXmjd

#Region "辅助函数"
    '''调用页面的HTTP信息对象
    Dim _context As HttpContext = HttpContext.Current

    '''功能:    返回多个字段值的数组(字符型)
    '''参数:    a_strSQL        SQL语句
    '''         a_intColumns    要获取的字段个数，1－指一个字段，2－指两个字段
    '''返回值:  Array           返回多个字段值的数组(字符型)
    '''         数据库连接不成功，返回空一维数组(Items is Nothing)
    '''创建人:  黄威
    '''创建时间:2009-12-03
    Function GetDataItemArryString(ByVal a_strSQL As String, ByVal a_intColumns As Integer) As Array
        Dim dtTemp As DataTable
        Dim arrTemp(a_intColumns - 1) As String
        Dim i As Integer
        Try
            dtTemp = MyDB.GetDataTable(a_strSQL)
        Catch ex As Exception
            dtTemp = New DataTable()
        End Try
        If dtTemp.Rows.Count > 0 Then
            For i = 0 To a_intColumns - 1
                arrTemp(i) = dtTemp.Rows(0).Item(i).ToString
            Next
        End If
        Return arrTemp
    End Function
#End Region
    
    '''功能:    根据合约规划的工作项编码，获取合约规划关联的项目计划工作项信息
    '''参数:    a_strProjGUID   项目GUID
    '''         a_strWBSCode    工作项编码
    '''返回值:  Array           合约规划关联的项目计划工作项信息
    '''         Array(0)        项目主项计划工作项GUID(WorkGUID)
    '''         Array(1)        工作项计划开始日期(BeginDateJh)
    '''         数据库连接不成功，返回空一维数组(Items is Nothing)
    '''创建人:  黄威
    '''创建时间:2009-12-02
    Public Function GetWorkItemForBudget(ByVal a_strProjGUID As String, ByVal a_strWBSCode As String) As Array
        Dim strSQL As String
        Dim arrResult As Array
        Dim strBUGUID As String = _context.Session("BUGUID")
        strSQL = String.Format("SELECT Top 1 WorkGUID, BeginDateJh FROM jd_Work WHERE BUGUID = '{0}' AND ProjGUID = '{1}' AND WBSCode = '{2}'", strBUGUID, a_strProjGUID, a_strWBSCode)
        arrResult = GetDataItemArryString(strSQL, 2)
        Return arrResult
    End Function
End Class
